<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css" />
    <script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
    <![endif]-->
    <title></title>
</head>
<body>
<div class="contant">
<div class="row">
    <div class="top">资产部>外催任务</div>
    <div class="content applylist">
        <div class="box">
            <h1>外催任务列表</h1>
            <div class="list-block">
                <div class="row">
                    <!-- <a href="{:U('Bankrule/add')}"><button class="addcus"><span></span>添加规则</button></a> -->
                </div>
                <div class="row">
                    <table class="list">
                        <tr>
                            <th>ID</th> <th>身份证</th> <th>银行卡号</th> <th>逾期月份</th> <th>逾期金额</th><th>指派对象</th><th>操作</th>
                        </tr>
                        <volist name="list" id="_overdue">
                            <tr>
                                <td>{$_overdue.id}</td>
                                <td>{$_overdue.indenty_no}</td>
                                <td>{$_overdue.bank_card}</td>
                                <td>{$_overdue.overdue_month}</td>
                                <td>{$_overdue.overdue_money}</td>
                                <td id="task{$_overdue.id}"><b>
                                <switch name="_overdue.task_status">
                                    <case value="0">无需操作</case>
                                    <case value="1">电催</case>
                                    <case value="2">外催</case>
                                    <case value="3">法务</case>
                                    <case value="4">完成</case>
                                    <default />default
                                </switch></b>
                                </td>
                                <td><a class="point-task" data-id={$_overdue.id} data-toggle="modal" data-target="#telbak" href="##">填写反馈</a></td>
                            </tr>
                        </volist>
                    </table>
                </div>
                {$page}
            </div>
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="telbak" tabindex="-1" role="dialog" aria-labelledby="telbakLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="telbakLabel">外催反馈</h4>
      </div>
      <div class="modal-body">
        <div class="box form-horizontal">
            <div class="list-block">
                <div class="form-group">
                    <label for="bank" class="col-sm-2 control-label">外催结果</label>
                    <div class="col-sm-5">
                        <input type="hidden" id="overdue-id">
                        <select id="execute-type" name="execute_type" class="form-control">
                            <option value="1">家里没人</option>
                            <option value="2">找不到车</option>
                            <option value="3">敲门不开</option>
                            <option value="4">电话停机</option>
                            <option value="5">态度恶劣</option>
                            <option value="6">其他</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">备注</label>
                    <div class="col-sm-10">
                        <textarea id="feedback" class="form-control" rows="5" cols="20" name="feedback" placeholder="反馈信息"></textarea>
                    </div>
                </div>
            </div>
        </div>
      </div>

      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">暂不反馈</button>
        <button id="sub-feedback" type="button" class="btn btn-primary">提交反馈</button>
      </div>
    </div>
  </div>
</div>
</div>

<script type="text/javascript">
    // 传递overdue-id
    $('.point-task').click(function(){
        var overdueId = $(this).attr('data-id');
        $('#overdue-id').val(overdueId);
    });

    // 提交反馈信息
    $('#sub-feedback').click(function(){
        var overdueId   = $('#overdue-id').val();
        var executeType = $('#execute-type').val();
        var feedback    = $('#feedback').val();

        $.ajax({
           type: "POST",
           url: "__URL__/telbak",
           data: {
                overdue_id:overdueId,
                execute_type:executeType,
                feedback:feedback
            },
           success: function(msg){
                console.log(msg);
                if (msg > 1) {
                    alert('已经反馈');
                    window.location.reload()
                    return false;
                }else{
                    msg = $.parseJSON(msg);
                    alert(msg.message);
                }
           }
        });

        $(this).attr('data-dismiss','modal');
    });
</script>
</body>
</html>